const formatter = (row, column, cellValue) => {
  const { type, formatTexts } = column;
  if (type === 'text') {
    return cellValue || '--';
  }
  if (['boolean', 'array', 'map'].includes(type)) {
    let texts;
    if (type === 'boolean') {
      texts = formatTexts || ['否', '是'];
    } else if (type === 'array') {
      texts = formatTexts || [];
    } else if (type === 'map') {
      texts = formatTexts || {};
    }
    return texts[cellValue] || '--';
  }
  return cellValue;
};

export default formatter;
